package com.topisv.tms.repository.stock.instorage;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.topisv.tms.entity.stock.instorage.InstorageBill;

/**
 * 入库单_dao
 * @author ch
 *
 */
public interface InstorageBillDao extends PagingAndSortingRepository<InstorageBill, Long>, JpaSpecificationExecutor<InstorageBill> {

	@Query("select t from InstorageBill t where t.billCode=?")
	InstorageBill loadBillByCode(String billCode);
	@Query("select t from InstorageBill t where t.id=?")
	InstorageBill loadBillById(Long id);
	@Modifying
	@Query("update InstorageBill t set t.printFlag=?1 where t.billCode=?2")
	void updatePrintFlag(String printFlag,String billCode);

	@Modifying
	@Query("update InstorageBill t set t.status=?2 where t.billCode=?1")
	void updateStatus(String billCode, String status);
	
	@Query("select t from InstorageBill t where t.aboutCode=? ")
	InstorageBill loadBillByAboutCode(String aboutCode);

}